#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstring>

using namespace std;

class CDate
{
private:
    int year, month, day;

public:
    CDate()
    {
        year = 0;
        month = 0;
        day = 0;
    }
    CDate(int y, int m, int d)
    {
        year = y;
        month = m;
        day = d;
    }
    bool isLeapYear()
    {
        return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
    }

    int getYear()
    {
        return year;
    }
    int getMonth()
    {
        return month;
    }

    int getDay()
    {
        return day;
    }

    int getDayofYear()
    {
        int a[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if (isLeapYear())
        {
            a[2]++;
        }
        int sum = day;
        for (int i = 0; i < month; i++)
        {
            sum += a[i];
        }
        return sum;
    }
};

class Software
{
private:
    string name;
    char type;
    CDate date;
    char store;

public:
    Software()
    {
        name = ' ';
        type = 'o';
        store = 'D';
    }
    Software(Software &s) : date(s.date)
    {
        this->name = s.name;
        this->type = 'B';
        this->store = 'H';
    }
    Software(string name, char type, char store, int year, int month, int day) : date(year, month, day)
    {
        this->name = name;
        this->type = type;
        this->store = store;
    }
    void print()
    {
        CDate _date(2015, 4, 7);
        cout << "name:" << name << endl;
        cout << "type:";
        switch (type)
        {
        case 'O':
            cout << "original" << endl;
            break;
        case 'T':
            cout << "trial" << endl;
            break;
        case 'B':
            cout << "backup" << endl;
            break;
        default:
            break;
        }
        cout << "media:";
        switch (store)
        {
        case 'D':
            cout << "optical disk";
            break;
        case 'U':
            cout << "USB disk";
            break;
        case 'H':
            cout << "hard disk";
            break;
        default:
            break;
        }
        cout << endl;
        if (date.getYear() == 0 && date.getMonth() == 0 && date.getDay() == 0)
        {
            cout << "this software has unlimited use" << endl;
        }
        else if (date.getYear() <= 2015 && date.getMonth() <= 4 && date.getDay() < 7)
        {
            cout << "this software has expired" << endl;
        }
        else
        {
            cout << "this software is going to be expired in " << date.getDayofYear() - _date.getDayofYear() << " days" << endl;
        }
        // cout << endl;
    }
};

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string name;
        char type, store;
        int year, month, day;
        cin >> name >> type >> store >> year >> month >> day;
        Software s(name, type, store, year, month, day);
        s.print();
        cout << endl;
        Software s2(s);
        s2.print();
        if (t != 0)
        {
            cout << endl;
        }
    }

    return 0;
}

/*

*/